<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>无限分级清单管理</title>
    <style>
        body {
            font-family: 'Arial', sans-serif;
            max-width: 800px;
            margin: 0 auto;
            padding: 20px;
            background-color: #f5f5f5;
        }
        
        .toolbar {
            margin-bottom: 20px;
            display: flex;
            gap: 10px;
        }
        
        button {
            padding: 8px 12px;
            background-color: #4CAF50;
            color: white;
            border: none;
            border-radius: 4px;
            cursor: pointer;
        }
        
        button:hover {
            background-color: #45a049;
        }
        
        input[type="text"] {
            padding: 8px;
            border: 1px solid #ddd;
            border-radius: 4px;
            flex-grow: 1;
        }
        
        .tree-container {
            background-color: white;
            border-radius: 8px;
            padding: 15px;
            box-shadow: 0 2px 5px rgba(0,0,0,0.1);
        }
        
        .tree-node {
            margin-bottom: 5px;
        }
        
        .node-header {
            padding: 8px;
            background-color: #f9f9f9;
            border-radius: 4px;
            display: flex;
            align-items: center;
            cursor: pointer;
            user-select: none;
            border: 1px solid #eee;
        }
        
        .node-header:hover {
            background-color: #f0f0f0;
        }
        
        .node-header span:first-child {
            margin-right: 8px;
            width: 20px;
            text-align: center;
        }
        
        .node-children {
            margin-left: 25px;
            border-left: 2px solid #eee;
            padding-left: 15px;
        }
        .node-checkbox {
    margin-right: 8px;
    cursor: pointer;
}

#batch-delete:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

.node-header.checked {
    background-color: #e3f2fd;
    border-left: 3px solid #2196F3;
}
        .node-actions {
            margin-left: auto;
            display: flex;
            gap: 5px;
        }
        
        .node-actions button {
            padding: 2px 6px;
            font-size: 12px;
            background-color: #e7e7e7;
            color: #333;
        }
        .node-content {
    padding: 8px 15px;
    margin-top: 5px;
    background-color: #f8f8f8;
    border-radius: 4px;
    border-left: 3px solid #ddd;
    font-size: 14px;
    color: #555;
    white-space: pre-wrap; /* 保留换行和空格 */
}

.node-title {
    flex-grow: 1;
    margin: 0 10px;
}
.title-content-container {
    flex-grow: 1;
    display: flex;
    align-items: center;
    min-width: 0; /* 允许文本截断 */
}

.node-title {
    margin: 0 5px;
    white-space: nowrap;
}

.separator {
    color: #aaa;
    margin: 0 5px;
}

.content-preview {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #666;
    cursor: pointer;
}

.content-preview:hover {
    color: #333;
}

/* 保持原有样式不变 */
.node-header {
    display: flex;
    align-items: center;
    padding: 8px;
    /* 其他原有样式 */
}

.node-header {
    display: flex;
    align-items: center;
    padding: 8px;
    /* 其他原有样式保持不变 */
}
		
		
		
		
        .node-actions button:hover {
            background-color: #ddd;
        }
        
        .editor-modal {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-color: rgba(0,0,0,0.5);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 1000;
        }
        
        .editor-content {
            background-color: white;
            padding: 20px;
            border-radius: 8px;
            width: 80%;
            max-width: 500px;
        }
        
        .editor-actions {
            display: flex;
            justify-content: flex-end;
            gap: 10px;
            margin-top: 15px;
        }
        
        textarea {
            width: 100%;
            min-height: 100px;
            padding: 8px;
            border: 1px solid #ddd;
            border-radius: 4px;
            margin-top: 10px;
        }
        
        .drag-over {
            background-color: #e3f2fd !important;
        }
    </style>
</head>
<body>
    <div id="app">
<div class="toolbar">
    <button id="add-root">添加根项目</button>
    <input type="text" id="search" placeholder="搜索清单...">
	<button id="select-all">全选</button>
    <button id="deselect-all">取消全选</button>
	<button id="batch-delete" disabled>批量删除</button>
    <button id="export-btn">导出数据</button>
    <input type="file" id="import-btn" accept=".json" style="display: none;">
    <button onclick="document.getElementById('import-btn').click()">导入数据</button>
</div>
        
        <div class="tree-container" id="tree-container">
            <!-- 清单树将在这里动态生成 -->
        </div>
        
        <!-- 编辑模态框 -->
        <div class="editor-modal" id="editor-modal" style="display: none;">
            <div class="editor-content">
                <h3 id="editor-title">编辑项目</h3>
                <input type="text" id="edit-title" placeholder="标题">
                <textarea id="edit-content" placeholder="详细内容"></textarea>
                <div class="editor-actions">
                    <button id="cancel-edit">取消</button>
                    <button id="save-edit">保存</button>
                </div>
            </div>
        </div>
    </div>

    <script src="app.js"></script>
</body>
</html>